function setFrozenColumns(gridpanel,grid,index){
	lockColumn(gridpanel,grid,index);		
 	$(gridpanel + " th[role='columnheader']").mouseenter(  function(){			
		if($(this).find(".lock").length<=0){
			$(this).find("span:first-child").first().after("<span id='v' class='vlock'></span>");
		}
	  	var t=this;
	  	$(this).find(".vlock").click(function(){
	  		$(t).siblings().find(".lock").remove();	  	
	  		$(this).remove();
	  	 	lockColumn(gridpanel,grid,$(t).index());
	  	});
	}).mouseleave(function(){
		$(this).find(".vlock").remove();
	});
}
	
function lockColumn(gridpanel,grid,index){
	var $grid=$(grid);
 	var cm = $grid.jqGrid("getGridParam", "colModel");
	for(var i=0;i<cm.length;i++)
		$grid.jqGrid('setColProp',cm[i].name  , {frozen:false});  		
	$grid.jqGrid('destroyFrozenColumns');     	     	     	     	
 	for(i=0;i<=index;i++){     		
 		$grid.jqGrid('setColProp',cm[i].name , {frozen:true});
 	}
  	$grid.jqGrid('setFrozenColumns');
  	$grid.trigger('reloadGrid', [{current:true}]);
  	$(gridpanel + " th[role='columnheader']:eq(-1)").find("span:first-child").first().after("<span id='lock' class='lock'></span>");		
}
